package com.chase.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chase.springboot.model.entity.Comment;
import com.chase.springboot.model.vo.CommentVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface CommentMapper extends BaseMapper<Comment> {

    /**
     * getCommentsByTopicID
     *
     * @param topicId
     * @return
     */
    List<CommentVO> getCommentsByTopicID(@Param("topicId") String topicId);

    /**
     * 获取第一层评论
     * @param topicId
     * @return
     */
    List<CommentVO> getFirstLayerComments(@Param("topicId") String topicId);

    /**
     * 通过评论id获取其子评论
     * @param commentId
     * @return
     */
    List<CommentVO> getCommentsByCommentId(@Param("commentId") String commentId);

    String getReplyUsername(@Param("commentId") String commentId);

}
